Skip to content

Conversation

gkepka
Copy link
Contributor

@gkepka gkepka commented Dec 12, 2024

No description provided.

{% tabs traits_7 %}
{% tab 'Scala 2 and 3' %}
```scala
val s = new MyService("ComposedService") with GreetingService with TranslationService
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intuitively, after seeing the syntax used above, someone could expect this to be defined in Scala 3 as:

val s = MyService("ComposedService") with GreetingService, TranslationService

It seems like only the Scala 2 syntax is accepted, though.

{% tabs fun-partial-5 class=tabs-scala-version%}
{% tab 'Scala 2' %}
```scala
doubledOdds.applyOrElse(4, (i: Int) => i + 1) // 5
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small fix which I omitted last time somehow.

Comment on lines +885 to +887
### Overriding an implemented method

A class can also override a method that is defined in a trait. Here is an example:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This covers both Overriding an implemented method and Mixing in multiple traits that have behaviors parts from the Scala 2 version.

@gkepka gkepka closed this by deleting the head repository Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant